package EA;

public class Framework
{
  /** The current iteration. */
  public int iteration;

  /** The fitness function for this framework. */
  public Fitness fitnessfunction;
  
  /** True if the current problem is a maximization problem. */
  public boolean ismaximization;

  /** Create a new framework. This used when the framework is just used 
      to access implementation dependent variables.
  */
  public Framework()
    {
      super();
      fitnessfunction = null;
    }

  /** Create a new Framework. */
  public Framework(Fitness ffunction)
    {
      super();
      fitnessfunction = ffunction;
    }

  /** Call this for starting a full run of your implemented EA. <br>
      The method does the following.<br><tt>
      initialize();<br>
      while(terminate()) {<br>
	Framework_doEA_inner();<br>
	iteration++;<br>
      }<br>
      summarize();<br></tt>
  */
  public void doEA()
    {
      initialize();
      while(terminate()) {
	Framework_doEA_inner();
	iteration++;
      }
      summarize();
    }

  /** BETA style inner call for doEA(). <br>
      This method is called form doEA and should contain the various 
      parts of the evolutionary loop.
  */
  public void Framework_doEA_inner()
    {
    }

  /** Override this to set termination condition. 
      @return boolean - false when the evaluation loop should end.
  */
  public boolean terminate()
    {
      return false;
    }

  /** Perform initialization. This method sets iteration to 0 and calls 
     the Framework_initialize_inner() method.
  */
  public void initialize()
    {
      iteration = 0;
      Framework_initialize_inner();
    }

  /** BETA style inner call for initialize(). <br>
      Override this in subclasses to perform initialization.
  */
  public void Framework_initialize_inner()
    {
    }

  /** Perform summarization. This method is called after the evolutionary loop
      and can be used to clean variables, store statistics etc.
  */
  public void summarize()
    {
      Framework_summarize_inner();
    }

  /** BETA style inner call for summarize(). <br>
      Override this in subclasses to perform summarization.
  */
  public void Framework_summarize_inner()
    {
    }

  /** Override this in your implementation. */
  public void selection()
    {
    }

  /** Override this in your implementation. */
  public void alter()
    {
    } 

  /** Override this in your implementation. */
  public void recombine()
    {
    }

  /** Override this in your implementation. */
  public void evaluate()
    {
    }



}
